package cn.xhb.service.impl;

import cn.xhb.domain.User;
import cn.xhb.mapper.UserMapper;
import cn.xhb.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class userServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;


    public User login(String userName, String password) {
        User user=userMapper.findByUserName(userName);
        if (user!=null&&user.getPassword().equals(password)){
            return user;
        }else {
            return null;
        }
    }

    public void add(User user) {
        userMapper.add(user);
    }

}
